package com.huanqiu.mylib.util;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

public final class MediaStoreUtil {

    @RequiresApi(api = SystemVersion.Android_10)
    public static void finishPending(@NonNull Context context, @NonNull Uri uri) {
        if (Build.VERSION.SDK_INT < SystemVersion.Android_10) return;

        ContentResolver contentResolver = context.getContentResolver();
        ContentValues cv = new ContentValues();
        cv.put(MediaStore.MediaColumns.IS_PENDING, false);
        contentResolver.update(uri, cv, null, null);
    }

}
